import request from '@/sheep/request';
import $platform from '@/sheep/platform';

export default {
  profile: () =>
    request({
      url: 'user.user/profile',
      method: 'GET',
      custom: {
        auth: true,
      },
    }),
  customerAdd: (data) =>
    request({
      url: 'api/customer/add',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true
      },
      data
    }),
  customerList: (params) =>
    request({
      url: 'api/customer/index',
      method: 'GET',
      custom: {
        auth: true,
      },
      params
    }),
  customerView: (params) =>
    request({
      url: 'api/customer/view',
      method: 'GET',
      custom: {
        auth: true,
      },
      params
    }),
  assteAdd: (data) =>
    request({
      url: 'api/asset/add',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true
      },
      data
    }),
  dailyYield: (data) =>
    request({
      url: 'api/daily_yield/add',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true,
        showError: true
      },
      data
    }),
  dailyView: (params) =>
    request({
      url: 'api/daily_yield/view',
      method: 'GET',
      custom: {
        auth: true,
      },
      params
    }),
  dailyCancellation: (data) =>
    request({
      url: 'api/daily_yield/cancellation',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true
      },
      data
    }),
  dailyEdit: (data) =>
    request({
      url: 'api/daily_yield/edit',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true
      },
      data
    }),
  dailyIndex: (params) =>
    request({
      url: 'api/daily_yield/index',
      method: 'GET',
      custom: {
        auth: true,
      },
      params
    }),
  assteView: (params) =>
    request({
      url: 'api/asset/view',
      method: 'GET',
      custom: {
        auth: true,
      },
      params
    }),
  assteList: (params) =>
    request({
      url: 'api/asset/index',
      method: 'GET',
      custom: {
        auth: true,
      },
      params
    }),
  assetIndex: (params) =>
    request({
      url: 'api/asset_category/index',
      method: 'GET',
      custom: {
        auth: true,
      },
      params
    }),
  customerEdit: (data) =>
    request({
      url: 'api/customer/edit',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true
      },
      data
    }),
  update: (data) =>
    request({
      url: 'user.user/update',
      method: 'POST',
      custom: {
        auth: true,
      },
      data,
    }),
  report: (data) =>
    request({
      url: 'api/daily_record/add',
      method: 'POST',
      custom: {
        auth: true,
      },
      data,
    }),
  purchaseRequisition: (data) =>
    request({
      url: 'api/purchase/add',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true,
      },
      data,
    }),
  purchaseIndex: (params) =>
    request({
      url: 'api/purchase/index',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  purchaseView: (params) =>
    request({
      url: 'api/purchase/view',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  evectionAdd: (data) =>
    request({
      url: 'api/evection/add',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true,
      },
      data,
    }),

  borrowingAdd: (data) =>
    request({
      url: 'api/borrowing/add',
      method: 'GET',
      custom: {
        auth: true,
      },
      data,
    }),
  borrowingView: (params) =>
    request({
      url: 'api/borrowing/view',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  evectionView: (params) =>
    request({
      url: 'api/evection/view',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  evectionIndex: (params) =>
    request({
      url: 'api/evection/index',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  borrowingIndex: (params) =>
    request({
      url: 'api/borrowing/index',
      method: 'POST',
      custom: {
        auth: true,
      },
      params,
    }),
  getUserByGroup: (params) =>
    request({
      url: 'api/user/getUserByGroup',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  returnedInfo: (params) =>
    request({
      url: 'api/returned_info/index',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  returnedView: (params) =>
    request({
      url: 'api/returned_info/view',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  returnedAdd: (params) =>
    request({
      url: 'api/returned_info/add',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true
      },
      params,
    }),
  returnedDel: (params) =>
    request({
      url: '/api/returned_info/del',
      method: 'GET',
      custom: {
        auth: true,
        showSuccess: true
      },
      params,
    }),
  returnedEdit: (params) =>
    request({
      url: 'api/returned_info/edit',
      method: 'POST',
      custom: {
        auth: true,
        showSuccess: true
      },
      params,
    }),
  attendanceDay: (data) =>
    request({
      url: 'api/attendance_record/statistics_day',
      method: 'GET',
      custom: {
        auth: true,
      },
      data,
    }),
  attendanceweek: (params) =>
    request({
      url: 'api/attendance_record/statistics_week',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  attendancemonth: (params) =>
    request({
      url: 'api/attendance_record/statistics_month',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  attendancereview: (params) =>
    request({
      url: 'api/attendance_record/config',
      method: 'GET',
      custom: {
        auth: true,
      },
      params,
    }),
  // 账号登录
  accountLogin: (data) =>
    request({
      url: 'user.user/accountLogin',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '登录中',
      },
    }),
  reimburseAdd: (data) =>
    request({
      url: 'api/reimburse/add',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        auth: true,
      },
    }),
  // 短信登录
  smsLogin: (data) =>
    request({
      url: 'user.user/smsLogin',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '登录中',
      },
    }),
  // 短信注册
  smsRegister: (data) =>
    request({
      url: 'user.user/smsRegister',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '正在注册',
      },
    }),
  // 重置密码
  resetPassword: (data) =>
    request({
      url: 'user.user/resetPassword',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '验证中',
      },
    }),
  // 修改密码
  changePassword: (data) =>
    request({
      url: 'user.user/changePassword',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '验证中',
      },
    }),
  // 绑定、更换手机号
  changeMobile: (data) =>
    request({
      url: 'user.user/changeMobile',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '验证中',
      },
    }),
  // 修改用户名
  changeUsername: (data) =>
    request({
      url: 'user.user/changeUsername',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '验证中',
      },
    }),
  // 更新小程序信息
  updateMpUserInfo: (data) =>
    request({
      url: 'user.user/updateMpUserInfo',
      method: 'POST',
      data,
    }),

  // 第三方授权信息
  thirdOauthInfo: () =>
    request({
      url: 'user.user/thirdOauth',
      method: 'GET',
      params: {
        provider: $platform.provider,
        platform: $platform.platform,
      },
      custom: {
        showLoading: false,
      },
    }),

  // 添加分享记录
  addShareLog: (data) =>
    request({
      url: 'share/add',
      method: 'POST',
      data,
      custom: {
        showError: false,
      },
    }),
  share: {
    list: (params) =>
      request({
        url: 'share',
        method: 'GET',
        params,
      }),
  },
  // 账号登出
  logout: (data) =>
    request({
      url: 'user.user/logout',
      method: 'POST',
      data,
    }),
  // 账号注销
  logoff: (data) =>
    request({
      url: 'user.user/logoff',
      method: 'POST',
      data,
    }),

  address: {
    default: () =>
      request({
        url: 'user.address/default',
        method: 'GET',
        custom: {
          showError: false,
        },
      }),
    list: () =>
      request({
        url: 'user.address',
        method: 'GET',
        custom: {},
      }),
    create: (data) =>
      request({
        url: 'user.address/add',
        method: 'POST',
        data,
        custom: {
          showSuccess: true,
        },
      }),
    update: (id, data) =>
      request({
        url: 'user.address/edit',
        method: 'POST',
        params: {
          id: id,
        },
        data,
        custom: {
          showSuccess: true,
        },
      }),
    detail: (id) =>
      request({
        url: 'user.address/detail',
        method: 'GET',
        params: {
          id: id,
        },
      }),
    delete: (id) =>
      request({
        url: 'user.address/delete',
        method: 'DELETE',
        params: {
          id: id,
        },
      }),
  },
  invoice: {
    list: () =>
      request({
        url: 'user.invoice',
        method: 'GET',
        custom: {},
      }),
    create: (data) =>
      request({
        url: 'user.invoice/add',
        method: 'POST',
        data,
        custom: {
          showSuccess: true,
        },
      }),
    update: (id, data) =>
      request({
        url: 'user.invoice/edit',
        method: 'POST',
        params: {
          id: id,
        },
        data,
        custom: {
          showSuccess: true,
        },
      }),
    detail: (id) =>
      request({
        url: 'user.invoice/detail',
        method: 'GET',
        params: {
          id: id,
        },
      }),
    delete: (id) =>
      request({
        url: 'user.invoice/delete',
        method: 'DELETE',
        params: {
          id: id,
        },
      }),
  },
  goodsLog: {
    list: (params) =>
      request({
        url: 'user.goods_log',
        method: 'GET',
        params,
      }),
  },
  favorite: {
    do: (id) =>
      request({
        url: 'user.goods_log/favorite',
        method: 'POST',
        data: {
          goods_id: id,
        },
        custom: {
          showSuccess: true,
          auth: true,
        },
      }),
    cancel: (id) =>
      request({
        url: 'user.goods_log/favorite',
        method: 'POST',
        data: {
          goods_ids: id,
        },
        custom: {
          showSuccess: true,
          auth: true,
        },
      }),
  },
  view: {
    delete: (data) =>
      request({
        url: 'user.goods_log/viewDel',
        method: 'DELETE',
        data,
        custom: {
          showSuccess: true,
        },
      }),
  },
  wallet: {
    log: (params) =>
      request({
        url: 'user.wallet_log',
        method: 'GET',
        params,
        custom: {},
      }),
  },
  account: {
    info: (params) =>
      request({
        url: 'user.account',
        method: 'GET',
        params,
        custom: {
          showError: false,
          auth: true,
        },
      }),
    save: (data) =>
      request({
        url: 'user.account/save',
        method: 'POST',
        data,
        custom: {
          showSuccess: true,
          auth: true,
        },
      }),
    username: (data) =>
      request({
        url: 'api/user/authentication',
        method: 'POST',
        data,
        custom: {
          auth: true,
          showSuccess: true,
        },
      }),

  },
  //数量接口
  data: () =>
    request({
      url: 'user.user/data',
      method: 'GET',
      custom: {
        showLoading: false,
        auth: true,
      },
    }),
  // 用户：入职申请接口
  userAdd: (data) => 
  request({
    url:'/api/entry_info/add',
    method:'POST',
    custom:{
      auth: true,
      showSuccess: true
    },
    data
  }),
 // 入职申请（2-个人签字）
 enrollmentSignature: (params) => 
  request({
    url:'/api/entry_info/enrollment_signature',
    method:'POST',
    custom:{
      auth: true,
      showSuccess: true
    },
    params
  }),
   // 入职申请（3-合同签字）
 contactSignature: (data) => 
  request({
    url:'/api/entry_info/contact_signature',
    method:'POST',
    custom:{
      auth: true,
      showSuccess: true
    },
    data
  }),
  // 用户：获取用户是否入职
  getUserEntry:() => 
  request({
    url:'/api/entry_info/get_user_isjoin',
    method:'GET',
    custom:{
      auth:true,
    },
  }),


  // 用户: 离职申请
  dimissionSubmit:(data) =>
  request({
    url:'/api/dimission/add',
    method:'POST',
    custom:{
      auth:true,
      showSuccess: true
    },
    data
  }),

  // 用户：离职详情
  DimissionView:(params) =>
  request({
    url:'/api/dimission/view',
    method:'GET',
    custom:{
      auth:true,
      showSuccess: false,
      showError: false
    },
    params
  }),
  
  // 用户：离职列表
    DimissionList:(params) =>
  request({
    url:'/api/dimission/approve_list',
    method:'GET',
    custom:{
      auth:true,
      showLoading:true,
      showSuccess: false,
      showError: true
    },
    params
  }),

  // 用户：获取全部员工
  getEntryStaff:(params) =>
  request({
    url:'/api/user/getEntryStaff',
    method:'GET',
    custom:{
      auth:true,
      showLoading:true,
      showSuccess: false,
      showError: true
    },
    params
  }),

  // 用户：获取员工详情
  staffView:(params) =>
  request({
    url:'/api/user/getEntryStaffDetail',
    method:'GET',
    params,
    custom:{
      auth:true,
      showLoading:true,
      showSuccess: false,
      showError: false
    },
  }),
};
